<template>
    <Card>
        <div v-show="this.$store.state.app.execute"><Tag type="dot" color="blue">{{this.$store.state.app.patientName}} - {{this.$store.state.app.medicalNumber}}</Tag><Button type="warning" @click="exit">退出</Button></div>
        <Tabs type="card">
            <TabPane label="执行医嘱">
                <medical-execute></medical-execute>
            </TabPane>
            <TabPane label="执行记录">
                <Tabs :value="selectPreview" @on-click="clickPreview">
                    <TabPane label="长期(项目)医嘱-执行记录" name="1">
                        <execute-preview ref="preview1" :type="1" :treatType="'2,3'" :itemType="1"></execute-preview>
                    </TabPane>
                    <TabPane label="长期(产品)医嘱-执行记录" name="2">
                        <execute-preview ref="preview2" :type="2" :treatType="'2,3'" :itemType="2"></execute-preview>
                    </TabPane>
                    <TabPane label="临时医嘱-执行记录" name="3">
                        <execute-preview ref="preview3" :type="3" :treatType="1" :itemType="'1,2'"></execute-preview>
                    </TabPane>
                </Tabs>
            </TabPane>
        </Tabs>
    </Card>
</template>

<script>
import iviewTable from '@/view/common/table/Table.vue';
import iviewPage from '@/view/common/page/Page.vue';
import medicalExecute from '@/view/business/medical/list/MedicalExecute.vue';
import executePreview from '@/view/business/medical/list/Execute.vue';
export default {
    components: {
        iviewTable,
        iviewPage,
        medicalExecute,
        executePreview
    },
    data () {
        return {
            selectPreview: ''
        }
    },
    filters: {
    },
    methods: {
        exit () {
            this.$bus.closePageToLink()
        },
        clickPreview (name) {
            if (name === '1') {
                this.$refs.preview1.refresh()
            } else if (name === '2') {
                this.$refs.preview2.refresh()
            } else if (name === '3') {
                this.$refs.preview3.refresh()
            }
            this.selectPreview = name
        }
    },
    created () {
        this.$store.state.app.execute = true
    },
    beforeRouteLeave (to, from , next) {
        this.$store.state.app.execute = false
        next()
    }
}
</script>

<style>
</style>
